End-of-line comments begin with two dashes ( --
)
or two slashes ( //
). Everything that follows
the second dash or slash, up to the end of the line, is
considered a comment and is ignored by the compiler. Note that
a backslash ( \
) within a comment is ignored. To
continue a comment onto the next line, you must precede that
line with dashes or slashes as well.
-- This is a comment that is quite verbose so I have
-- no choice but to continue it on the following line.
// This comment style is for lost souls who suffer C++ envyEnd-of-line comments are useful for appending to a line of code:
2 + 5 - (15 / 4) -- some random arithmeticInset or multiple-line comments (
true == false // a silly comparison
/* this is a comment
*/
) use the same notation as the C programming
language. Unlike C, ScriptX allows inset comments to be
nested, as in the following example./* This is part of a comment which
will continue for many lines,
/* and so is this,
and this too!
*/ But the comment is not finished yet!
This is still part of the same comment!
It ain't over till the woman of size sings!
*/
The ability to nest multiple-line comments provides a versatile mechanism for "commenting out" sections of source code. Although nested comments are more flexible than the unnested C-style comments, several other kinds of errors are possible. For example, by deleting a comment terminator that is nested within another comment, a developer might inadvertently comment out other parts of a program.
This document is part of the ScriptX Language Guide, one of the volumes of the ScriptX Technical Reference Series. ScriptX is developed by the ScriptX Engineering Team at Apple Computer, successor to the Kaleida Engineering Team at Kaleida Labs, Inc.